import unittest
from battle import *

class BattleTests(unittest.TestCase):
    def test_new_monster_is_not_dead(self):
        monster = Monster()
        self.assertFalse(is_dead(monster))
    def test_new_player_is_not_dead(self):
        player = Player()
        self.assertFalse(is_dead(player))
    def test_new_player_has_strength(self):
        player = Player()
        self.assertNotEqual(0, player.strength)
    def test_attacking_monster_depletes_its_hitpoints_by_your_strength(self):
        player = Player()
        monster = Monster()
        starting_hitpoints = monster.hitpoints
        player.attack(monster)
        self.assertEqual(monster.hitpoints, starting_hitpoints - player.strength)
    def test_can_kill_monster_by_attacking_repeatedly(self):
        player = Player()
        monster = Monster()
        hits_to_death = monster.hitpoints / player.strength
        [player.attack(monster) for _ in range(hits_to_death)]
        self.assertTrue(is_dead(monster))

if __name__ == '__main__':
    unittest.main()